# coding: utf-8
# 文件名称: cookie.py
# 创建时间: 2021/7/1 0:31

from selenium import webdriver
import time
import json

#填写webdriver的保存目录
driver_path = r'D:\Edgedriver\edgedriver_win64\msedgedriver.exe'
driver = webdriver.Edge(executable_path=driver_path)

#记得写完整的url 包括http和https
driver.get('http://mobile.yangkeduo.com/goods.html?goods_id=223203929667')

#程序打开网页后20秒内手动登陆账户
time.sleep(50)

with open('cookies.txt','w') as cookief:
    #将cookies保存为json格式
    cookief.write(json.dumps(driver.get_cookies()))

driver.close()